		{if $search_time}
		<input type="text" placeholder='开始日期' value="{:input('search_begintime')}" class="search_begintime time" name="search_begintime">
		<input type="text" placeholder='结束日期' value="{:input('search_endtime')}" class="search_endtime time" name="search_endtime">
		<script>laydate.render({ elem: '.search_begintime',type: 'datetime'});</script>
		<script>laydate.render({ elem: '.search_endtime',type: 'datetime'});</script>
		{/if}

		{if $sort_array}
	    <select name="search_fid">
			{volist name="$sort_array" id="name"}
			<option value="{$key}" {:input('search_fid')==$key?'selected':''}>{$name}</option>
			{/volist}
		</select>
		{/if}
		
		{if $status_array}
		<select name="search_status">
			<option value="">状态</option>
			{volist name="$status_array" id="name"}
			<option value="{$key}" {:input('search_status')==="$key"?'selected':''}>{$name}</option>
			{/volist}
		</select>
		{/if}

		<select name="search_field">
			<option value="">选择字段</option>
			{if $tab_ext.id}
				<option value="{$tab_ext.id}" {:input('search_field')=='id'?'selected':''}>{$tab_ext.id}</option>
			{else /}
				<option value="id" {:input('search_field')=='id'?'selected':''}>{$tab_ext.id_name?:'ID'}</option>
			{/if}
			{volist name="$tab_ext.search" id="name"}
				<option value="{$key}" {:input('search_field')==$key?'selected':''}>{$name}</option> 
			{/volist}
		</select>
		<input type="text" placeholder='请输入关键字' value="{:input('keyword')}" class="search_word" name="search_word"> <input onclick="search_content()" type="button" name="" value="搜索" class="layui-btn layui-btn-sm">

<script type="text/javascript">
function search_content(){
	var field = $("select[name='search_field']").val();
	var keyword = $("input[name='search_word']").val();
	var search_fid = $("select[name='search_fid']").length>0 ? $("select[name='search_fid']").val() : '';
	var search_status = $("select[name='search_status']").length>0 ? $("select[name='search_status']").val() : '';
	var search_begintime = $("input[name='search_begintime']").length>0 ? $("input[name='search_begintime']").val() : '';
	var search_endtime = $("input[name='search_endtime']").length>0 ? $("input[name='search_endtime']").val() : '';
	

	if(keyword!='' && field==''){
		layer.alert('请选择搜索字段类型');
		return ;
	}
	var url = location.href.indexOf('?')>0 ? location.href.substr(0,location.href.indexOf('?')) : location.href;
	url +='?search_field=' + field + '&keyword=' +keyword;
	if(search_fid!=''){
		url +='&search_fid=' + search_fid;
	}
	if(search_status!==''){
		url +='&search_status=' + search_status;
	}
	if(search_begintime!=''){
		url +='&search_begintime=' + search_begintime;
	}
	if(search_endtime!=''){
		url +='&search_endtime=' + search_endtime;
	}
	if(search_begintime!=''||search_endtime!=''){
		url +='&search_timefield={$search_time}';
	}
	window.location.href = url;
}
</script>